/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sg.edu.nus.iss.pacman.util;

import java.util.Date;

/**
 * A utility class for Date.
 * @author fredy
 */
public class DateUtils
{
    private DateUtils()
    {
    }

    /**
     * Converts the date to string.
     * @param date the date is yyyyMMdd
     * @return the converted string date
     */
    public static String convertDateToString(Date date)
    {
        String dateStr = date.toString();
        String day = dateStr.substring(8, 10);
        String month = dateStr.substring(4, 7);
        String year = dateStr.substring(24);
        StringBuffer sb = new StringBuffer();
        sb.append(day);
        sb.append("-");
        sb.append(month);
        sb.append("-");
        sb.append(year);
        return sb.toString();
    }
}
